<?php
if (!empty($_GET['url'])) {
	$url_long = $_GET['url'];
} else if (!empty($_POST['url'])) {
	$url_long = $_POST['url'];
} else {
	echo "url can not be empty.";
	return;
}
$api = "http://sa.sogou.com/gettiny?url=";
$url = $api . $url_long;
$tinyurl = file_get_contents($url);
echo $tinyurl;
